<?php
/**
 * Notes:
 * Created by PhpStorm.
 * Author: TS
 * Date: 2019/9/30
 * Time: 13:05
 */

namespace app\validate;


use think\Validate;

class UsersValidate extends Validate
{
    protected $rule = [
        'user_pwd' => 'require|min:8',
        'user_name' => 'max:20',
        'user_phone' => 'regex:/^1[3456789]\d{9}$/',
        'user_email' => 'email',
        'user_sex' => 'number'
    ];

    protected $message = [
        'user_pwd.require' => '密码不能为空',
        'user_pwd.min' => '密码不能少于8个字符',
        'user_sex.number' => '性别格式错误',
        'user_phone.regex' => '手机号码格式错误',
        'user_email.email' => '邮箱格式错误',
    ];

    protected $scene = [
      'signon' => [
          ['user_id','require','账号不能为空'],
          ['user_pwd','require','密码不能为空'],
      ]
    ];
}